package General;
import java.util.Map;
import java.util.HashMap;

public enum VictoryCards {
	LARGEST_ARMY{
		@Override
		public String toString(){
			return "Owner of the Largest Army";
		}
	}, MOST_BUILDINGS{
		public String toString(){
			return "Most Buildings Owned";
		}
	}, WON_LAST_BATTLE{
		public String toString(){
			return "Won The Last Battle";
		}
	},
	BUILT_WONDER{
		public String toString(){
			return "Builder of the Wonder";
		}
	};
	
	// 2 methods borrowed from Stack Overflow User MeBigFatGuy
	// http://stackoverflow.com/questions/5292790/convert-integer-value-to-matching-java-enum
	private static final Map<Integer, VictoryCards> intToTypeMap = new HashMap<Integer, VictoryCards>();
	static {
	    for (VictoryCards type : VictoryCards.values()) {
	        intToTypeMap.put(type.ordinal(), type);
	    }
	}
	public static VictoryCards fromInt(int i) {
	    VictoryCards type = intToTypeMap.get(Integer.valueOf(i));
	    if (type == null) 
	        return null;
	    return type;
	}
	// End code attribution

}
